export default {
    state: {
        status_bar: '0px',
        custom_bar: '0px',
        theme_color: {
            nddyny: '#fbbd08',
            deep_nddyny: '#ff9700'
        }
    },
    mutations: {
        appBackPage(state, data) {
            if (getCurrentPages().length < 2) {
                uni.reLaunch({
                    url: '/pages/page/index?nav=my'
                });
                return;
            }
            let pages = getCurrentPages();
            let prevPage = pages[pages.length - 2]; //上一个页面
            if (data && prevPage.$vm.backData) {
                prevPage.$vm.backData(data);
            }
            uni.navigateBack({
                delta: 1
            });
        },
        appShowModal(state, info) {
            uni.showModal({
                title: info.title,
                confirmColor: state.theme_color.nddyny,
                content: info.content,
                success: function(res) {
                    if (res.confirm && info.confirm) {
                        info.confirm();
                    } else if (res.cancel && info.cancel) {
                        info.cancel();
                    }
                }
            });
        }
    },
    actions: {},
    getters: {}
}
